package com.battery.system.domain;

import com.battery.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 采购订单对象 ws_purchase
 *
 * @author battery
 * @date 2021-01-22
 */
@Table(name = "ws_purchase")
public class Purchase {

    private static final long serialVersionUID = 1L;

    /**
     * 订单主键;同时也是订单编号
     */
    @Id
    @KeySql(useGeneratedKeys = true)
    private String id;

    /**
     * 直营合作商ID
     */
    @Excel(name = "直营合作商ID")
    private String partnerId;

    /**
     * 地址ID
     */
    @Excel(name = "地址ID")
    private String address;

    /**
     * 平台-项目ID
     */
    @Excel(name = "平台-项目ID")
    private String projectId;

    /**
     * 用户姓名
     */
    @Excel(name = "用户姓名")
    private String trueName;

    /**
     * 用户手机号
     */
    @Excel(name = "用户手机号")
    private String phone;

    /**
     * 备注
     */
    @Excel(name = "备注")
    private String remarks;


    @Transient
    private List<PurchaseItems> purchaseItems;

    /**
     * 订单总价格
     */
    @Excel(name = "订单总价格")
    private BigDecimal totalAmount;

    /**
     * 实际支付总价格
     */
    @Excel(name = "实际支付总价格")
    private BigDecimal realPayAmount;

    /**
     * 邮费;默认可以为零，代表包邮
     */
    @Excel(name = "邮费;默认可以为零，代表包邮")
    private BigDecimal postAmount;

    /**
     * 优惠价格
     */
    @Excel(name = "优惠价格")
    private BigDecimal discountAmount;

    /**
     * 支付方式
     */
    @Excel(name = "支付方式")
    private Long payMethod;

    /**
     * 买家留言
     */
    @Excel(name = "买家留言")
    private String leftMsg;

    /**
     * 扩展字段
     */
    @Excel(name = "扩展字段")
    private String extend;

    private PurchaseStatus purchaseStatus;

    public PurchaseStatus getPurchaseStatus() {
        return purchaseStatus;
    }

    public void setPurchaseStatus(PurchaseStatus purchaseStatus) {
        this.purchaseStatus = purchaseStatus;
    }

    /**
     *
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "", width = 30, dateFormat = "yyyy-MM-dd")
    private Date createdTime;

    /**
     *
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "", width = 30, dateFormat = "yyyy-MM-dd")
    private Date updatedTime;

    /**
     * 快递商
     */
    @Excel(name = "快递商")
    private String expressName;

    /**
     * 快递单号
     */
    @Excel(name = "快递单号")
    private String expressNumber;

    public List<PurchaseItems> getPurchaseItems() {
        return purchaseItems;
    }

    public void setPurchaseItems(List<PurchaseItems> purchaseItems) {
        this.purchaseItems = purchaseItems;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setPartnerId(String partnerId) {
        this.partnerId = partnerId;
    }

    public String getPartnerId() {
        return partnerId;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getAddress() {
        return address;
    }

    public void setProjectId(String projectId) {
        this.projectId = projectId;
    }

    public String getProjectId() {
        return projectId;
    }

    public void setTrueName(String trueName) {
        this.trueName = trueName;
    }

    public String getTrueName() {
        return trueName;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getPhone() {
        return phone;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }

    public BigDecimal getTotalAmount() {
        return totalAmount;
    }

    public void setRealPayAmount(BigDecimal realPayAmount) {
        this.realPayAmount = realPayAmount;
    }

    public BigDecimal getRealPayAmount() {
        return realPayAmount;
    }

    public void setPostAmount(BigDecimal postAmount) {
        this.postAmount = postAmount;
    }

    public BigDecimal getPostAmount() {
        return postAmount;
    }

    public void setDiscountAmount(BigDecimal discountAmount) {
        this.discountAmount = discountAmount;
    }

    public BigDecimal getDiscountAmount() {
        return discountAmount;
    }

    public void setPayMethod(Long payMethod) {
        this.payMethod = payMethod;
    }

    public Long getPayMethod() {
        return payMethod;
    }

    public void setLeftMsg(String leftMsg) {
        this.leftMsg = leftMsg;
    }

    public String getLeftMsg() {
        return leftMsg;
    }

    public void setExtend(String extend) {
        this.extend = extend;
    }

    public String getExtend() {
        return extend;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setUpdatedTime(Date updatedTime) {
        this.updatedTime = updatedTime;
    }

    public Date getUpdatedTime() {
        return updatedTime;
    }

    public void setExpressName(String expressName) {
        this.expressName = expressName;
    }

    public String getExpressName() {
        return expressName;
    }

    public void setExpressNumber(String expressNumber) {
        this.expressNumber = expressNumber;
    }

    public String getExpressNumber() {
        return expressNumber;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("partnerId", getPartnerId())
                .append("addressId", getAddress())
                .append("projectId", getProjectId())
                .append("trueName", getTrueName())
                .append("phone", getPhone())
                .append("remarks", getRemarks())
                .append("totalAmount", getTotalAmount())
                .append("realPayAmount", getRealPayAmount())
                .append("postAmount", getPostAmount())
                .append("discountAmount", getDiscountAmount())
                .append("payMethod", getPayMethod())
                .append("leftMsg", getLeftMsg())
                .append("extend", getExtend())
                .append("createdTime", getCreatedTime())
                .append("updatedTime", getUpdatedTime())
                .append("expressName", getExpressName())
                .append("expressNumber", getExpressNumber())
                .toString();
    }
}
